import request from '@/utils/request'
// import axios from 'axios'
import { apiVersion } from '@/config'

// 获取详情
export function getModelDetail(data) {
    console.log("getModelDetail");
    return request({
        url: `/admin/${apiVersion}/model/${data.id}`,
        method: 'get',
        data
    })
}
// 分页列表
export function getModels(data) {
    return request({
        url: `/admin/${apiVersion}/model`,
        method: 'get',
        data
    })
}
// 分页列表含所有版本
export function getModelsWithVersion(data) {
    return request({
        url: `/admin/${apiVersion}/model/withVersion`,
        method: 'get',
        data
    })
}
// 删除
export function delModel(data) {
    return request({
        url: `/admin/${apiVersion}/model/${data.id}`,
        method: 'delete',
        data
    })
}
// 创建
export function addModel(data) {
    return request({
        url: `/admin/${apiVersion}/model`,
        method: 'post',
        data
    })
}
export function putModel(data) {
    return request({
        url: `/admin/${apiVersion}/model`,
        method: 'put',
        data: data
    })
}
// 查询列表
export function getAllModels(data) {
    return request({
        url: `/admin/${apiVersion}/model/all`,
        method: 'get',
        data
    })
}
// 根据来源查询
export function getModelBySource(data) {
    return request({
        url: `/admin/${apiVersion}/model/bySource`,
        method: 'get',
        data
    })
}

/**
 * 获取模型评估指标或图示名称
 * @param {*} data
 */
export function metricKeys(data) {
    return request({
        url: `/admin/${apiVersion}/modelEvaluation/${data.id}/metric/keys`,
        noLoadding: true,
        headers: {
            "Content-Type": "application/x-www-form-urlencoded"
        },
        method: 'get',
        data
    })
}

/**
 * 获取模型评估指标或图示数据详情
 * @param {*} data
 */
export function metricData(data) {
    return request({
        url: `/admin/${apiVersion}/modelEvaluation/${data.id}/metric/data`,
        noLoadding: true,
        headers: {
            "Content-Type": "application/x-www-form-urlencoded"
        },
        method: 'get',
        data
    })
}

/**
 * 获取模型测试指标或图示名称
 * @param {*} data
 */
export function metricTestKeys(data) {
    return request({
        url: `/admin/${apiVersion}/modelTest/${data.id}/metric/keys`,
        noLoadding: true,
        headers: {
            "Content-Type": "application/x-www-form-urlencoded"
        },
        method: 'get',
        data
    })
}

/**
 * 获取模型测试指标或图示数据详情
 * @param {*} data
 */
export function metricTestData(data) {
    return request({
        url: `/admin/${apiVersion}/modelTest/${data.id}/metric/data`,
        noLoadding: true,
        headers: {
            "Content-Type": "application/x-www-form-urlencoded"
        },
        method: 'get',
        data
    })
}
